package com.dto.merchant;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

public class MasterCatalogDataModel extends ListDataModel<MasterCatalogDTO>
		implements SelectableDataModel<MasterCatalogDTO>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1244839402482878328L;

	public MasterCatalogDataModel() {

	}

	public MasterCatalogDataModel(List<MasterCatalogDTO> list) {
		super(list);
	}

	@SuppressWarnings("unchecked")
	@Override
	public MasterCatalogDTO getRowData(String rowKey) {
		List<MasterCatalogDTO> list=(List<MasterCatalogDTO>) getWrappedData();
		for(MasterCatalogDTO dto: list){
			if(String.valueOf(dto.getItemId()).equals(rowKey)){
				return dto;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(MasterCatalogDTO dto) {
		// TODO Auto-generated method stub
		return dto.getItemId();
	}

}
